package qeug.shsh.opplugin;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.form.plugin.AbstractFormPlugin;

public class PuReimSKFormPlugin extends AbstractFormPlugin  {
    @Override
    public void propertyChanged(PropertyChangedArgs e) {
        super.propertyChanged(e);
        String fieldKey = e.getProperty().getName();
        if ("supplier".equals(fieldKey)) {
            for (ChangeData changeData : e.getChangeSet()) {
                if (changeData.getNewValue() != null) {
                    int rowIndex = changeData.getRowIndex();
                    Object qeugAmountpayable = this.getModel().getValue("payertype",rowIndex);
                    if (qeugAmountpayable != null) {
                        //当收款信息改变的时候。如果收款人类型为供应商的时候，将银行账号，联行号，账户名称，开户行清楚
                        if("bd_supplier".equals(qeugAmountpayable.toString())){
                            this.getModel().setValue("payeraccount","",rowIndex);
                            this.getModel().setValue("qeug_union","",rowIndex);
                            this.getModel().setValue("payeraccountname","",rowIndex);
                            this.getModel().setValue("payerbank","",rowIndex);
                            this.getModel().setValue("payerbank","",rowIndex);
                        }
                    }
                }
            }
        }
    }
}
